<template>
    <div class="my-download">
        <el-table v-if="tableData && tableData.length > 0" class="table-download" :data="tableData" height="410px" style="width: 100%">
            <el-table-column prop="docname" label="名称" min-width="200px">
                <template slot-scope="scope">
                    <div class="name" @click="go(scope.row)">{{scope.row.docname}}</div>
                </template>
            </el-table-column>

            <el-table-column prop="uploader" label="上传用户">
            </el-table-column>

            <el-table-column prop="addtime" label="下载时间" width="100px">
                <template slot-scope="scope">
                    {{scope.row.addtime.slice(0,11)}}
                </template>
            </el-table-column>
        </el-table>

        <div class="empty" v-if="!tableData.length">
            <empty-list>
                <span>暂无数据</span>
            </empty-list>
        </div>

        <div class="pagination">
            <my-pagination ref="page" v-model="tableData" :action="`${$store.state.api.tbUrl}/center/userdownloads.json`" :loading.sync="loading"
                :search="pgData" :autoShow="false"></my-pagination>
        </div>
    </div>
</template>

<script>
import InfoCard from '../../components/info-card.vue';
import EmptyList from '@components/sys/empty-list';

export default {
    components: { InfoCard, EmptyList },
    data() {
        return {
            activeName: '1',
            loading: false,
            tableData: [],
            pgData: {
                pagesize: 10,
                sortname: 'addtime',
            },
        };
    },
    methods: {
        go(row) {
            window.open(`/document/${row.documentguid}`);
        },
    },
};
</script>



<style lang="scss" scoped>
.el-table::before {
    height: 0;
}
@import '@css/var.scss';
.my-download {
    ::v-deep .el-table th {
        border-bottom: none;
    }
    ::v-deep .el-table__cell {
        border-bottom: none;
        padding-bottom: 0px;
        padding: 6px 0;
    }
    .el-table::before {
        height: 0;
    }
    .table-download {
        ::v-deep .el-table__header-wrapper {
            overflow: hidden;
            margin-top: -10px;
        }
        ::v-deep tr{
            height: 37px;
        }
    }

    // .card {
    //     height: 442px;
    //     position: relative;

        .empty {
            height: 395px;
        }

        .name {
            overflow: hidden;
            text-overflow: ellipsis; //文本溢出显示省略号
            white-space: nowrap; //文本不会换行
            cursor: pointer;
            &:hover {
                color: $primaryColor;
            }
        }
        .title {
            font-weight: 600;
        }
        .items {
            // margin-top: 20px;

            &:first-child {
                margin-top: 0;
            }
        }
        .pagination{
            display: flex;
            justify-content: right;
        }
    // }
}
</style> 